package org.study.springboot.learning.socker;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * <p>Title: SingleServer <p>
 * <p>Description: TODO<p>
 *
 * @Author ZhangSY
 * @Date 2021/6/23 23:57
 * @Version v1.0
 **/
public class SingleServer {
    public static void main(String[] args) {
        ServerSocket serverSocket = null;
        try {
            serverSocket = new ServerSocket(18888);
        } catch (IOException e) {
            System.err.print("Could not listen on port:18888");
            System.exit(1);
        }
        Socket socket = null;
        try {
            while (true) {
                socket = serverSocket.accept();
                new HandleThread(socket).start();
            }
        } catch (IOException e) {
            System.err.println("Accept failed");
            System.exit(1);
        }
    }


}
